package com.ply.flashsalessystem.entity.pojo;

import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.ply.flashsalessystem.entity.dto.AddGoods;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 
 * </p>
 *
 * @author XiaoPan
 * @since 2022-03-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Goods对象", description="")
public class Goods implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "商品id")
    @TableId(value = "goods_id", type = IdType.AUTO)
    public Integer goodsId;

    @ApiModelProperty(value = "商品 name")
    public String name;

    @ApiModelProperty(value = "分类 id")
    public Integer tagId;

    @ApiModelProperty(value = "商品售价")
    public Double price;

    @ApiModelProperty(value = "剩余量 	( 可 售出量 )")
    public Double remainNums;

    @ApiModelProperty(value = "商品上下架, 0表示下架的情况 1表示上架的情况")
    public Integer putAway;

    @ApiModelProperty(value = "details详情")
    public String details;

    @ApiModelProperty(value = "默认商品余量")
    public Double defaultRemain;

    public String image;

    @ApiModelProperty(value = "最少起售 单位 克g")
    public Double minSales;

    public static Goods addGoodToGoods(AddGoods goods, String image){
        Goods goods1 = new Goods();
        goods1.setDetails(goods.getDetails());
        goods1.setRemainNums(goods.getRemainNums());
        goods1.setImage(image);
        goods1.setDefaultRemain(goods.getDefaultRemain());
        goods1.setPrice(goods.getPrice());
        goods1.setMinSales(goods.getMinSales());
        goods1.setName(goods.getName());
        goods1.setTagId(goods.getTagId());
        goods1.setRemainNums(goods.getRemainNums());
        return goods1;
    }
}
